package com.vogue.supplymall.common.domain.dto;
import java.io.Serializable;
import java.util.List;

/**
 * @aouthor: zhangliang
 * @date: Create in 2017-12-18
 */
public class UserInfo implements Serializable,Comparable<UserInfo> {
    /**
	 * 
	 */
	private static final long serialVersionUID = 7444196985106077732L;
	/**
     * 登录用户的ID
     */
    private Long loginId;
    /**
     * 登录用户手机
     */
    private String tel;
    /**
     * 登录用户用户名
     */
    private String username;
    /**
     * 用户昵称
     */
    private String name;
    /**
     * 登录用户的系统唯一注册号
     */
    private Long syscodeid;
    /**
     * 登录用户机构类型 0:个人用户  1:企业员工
     */
    private Integer loginUserType = 0;
    /**
     * 是否可切换选择机构信息
     */
    private Boolean selOrgFlag = false;
    /**
     * 登录用户的机构名称(企业名称)
     */
    private String entName;
    /**
     * 默认的机构（门店或者店铺对应的机构 Organ）
     */
    private OrganInfo organInfo;
    /**
     * 头像图片地址
     */
    private String headImgUrl;
    /**
     * 可管理机构的列表（门店及配送中心级别机构）
     */
    private List<OrganInfo> organList;
    /**
     * 是否为一次性登录性质（受限的一些请求会允许，正常的需登录的都会立刻注销掉，当做未登录抛异常）
     */
    private boolean onceFlag=false;
    
    /** 系统唯一码（不是id是用户获得的数字随机码） */
    private Long syscode = 0L; 
    
    /** 是否是管理员 */
    private boolean isAdmin = false;
    
    /** 平台账户的id */
    private Long accountid = 0L;
    
    public String getEntName() {
		return entName;
	}

	public void setEntName(String entName) {
		this.entName = entName;
	}

	public OrganInfo getOrganInfo() {
		return organInfo;
	}

	public void setOrganInfo(OrganInfo organInfo) {
		this.organInfo = organInfo;
	}

	public Long getLoginId() {
        return loginId;
    }

    public void setLoginId(Long loginId) {
        this.loginId = loginId;
    }
    
    public Long getSyscodeid() {
        return syscodeid;
    }

    public void setSyscodeid(Long syscodeid) {
        this.syscodeid = syscodeid;
    }
    
    public Integer getLoginUserType() {
        return loginUserType;
    }

    public void setLoginUserType(Integer loginUserType) {
        this.loginUserType = loginUserType;
    }
    
	public String getTel() {
		return tel;
	}

	public void setTel(String tel) {
		this.tel = tel;
	}

	public String getUsername() {
		return username;
	}

	public void setUsername(String username) {
		this.username = username;
	}
	
	public String getName() {
		return name;
	}

	public void setName(String name) {
		this.name = name;
	}	
	
	public String getHeadImgUrl() {
		return headImgUrl;
	}

	public void setHeadImgUrl(String headImgUrl) {
		this.headImgUrl = headImgUrl;
	}	

	public boolean isOnceFlag() {
		return onceFlag;
	}

	public void setOnceFlag(boolean onceFlag) {
		this.onceFlag = onceFlag;
	}

	public List<OrganInfo> getOrganList() {
		return organList;
	}

	public void setOrganList(List<OrganInfo> organList) {
		this.organList = organList;
	}

	public Long getSyscode() {
		return syscode;
	}

	public void setSyscode(Long syscode) {
		this.syscode = syscode;
	}

	public boolean isAdmin() {
		return isAdmin;
	}

	public void setIsAdmin(boolean isAdmin) {
		this.isAdmin = isAdmin;
	}

	public Boolean getSelOrgFlag() {
		return selOrgFlag;
	}

	public void setSelOrgFlag(Boolean selOrgFlag) {
		this.selOrgFlag = selOrgFlag;
	}

	public Long getAccountid() {
		return accountid;
	}

	public void setAccountid(Long accountid) {
		this.accountid = accountid;
	}

	@Override
	public int compareTo(UserInfo o) {
		// TODO Auto-generated method stub
		return this.loginId.compareTo(o.getLoginId());
	}
	
	@Override  
	public int hashCode() {     
	    final int prime = 31;       
	    int result = 1;     
	    result += prime * result + ((loginId == null) ? 0 : loginId.hashCode());       
	    result += prime * result + ((tel == null) ? 0 : tel.hashCode());     
	    return result;  
	}
	    
	@Override
	public boolean equals(Object obj) {
		if (this == obj) {
			return true;
		}
		if (obj == null) {
			return false;
		}
		if (!getClass().equals(obj.getClass())) {
			return false;
		}
		if (getClass().getPackage() != obj.getClass().getPackage()) {
			return false;
		}
		final UserInfo other = (UserInfo) obj;
		if (loginId == null) {
			if (other.getLoginId() != null) {
				return false;
			}
		} else if (!loginId.equals(other.getLoginId())) {
			return false;
		}
		return true;
	}
	
	@Override
	public String toString() {
	    return loginId != null ? loginId.toString() : "";
	}
}
